#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int dp[2][2][2];

int main() {
  int n;
  string s;
  cin >> n >> s;

  // 修改初始化
  for (int j = 0; j < 2; j++) {
    for (int k = 0; k < 2; k++) {
      dp[1][j][k] = (j != s[0] - '0') + (k != s[1] - '0');
    }
  }

  for (int i = 2; i < n; i++) {
    int curr = i & 1, prev = 1 - curr;
    int cost = (s[i] != '0');

    // s[i]修改成0
    dp[curr][0][0] = min(dp[prev][0][0], dp[prev][0][1]) + cost;
    dp[curr][0][1] = dp[prev][1][0] + cost;

    // s[i]修改成1
    cost = 1 - cost; // 翻转cost
    dp[curr][1][0] = min(dp[prev][0][0], dp[prev][0][1]) + cost;
    dp[curr][1][1] = min(dp[prev][1][0], dp[prev][1][1]) + cost;
  }

  int last = (n - 1) & 1;
  cout << min({dp[last][0][0], dp[last][0][1], dp[last][1][0], dp[last][1][1]});
  return 0;
}
